/******************************************************************************
* AIR SYSTEMS LABORATORY
* AEROSPACE ENGINEERING
* UNIVERISTY OF TEXAS AT AUSTIN
* UAV FLIGHT SOFTWARE 
* DESCRIPTION:
*   
*
* SOURCE: 
* Orignial: 08/14/2008  Jorge Alvarez joroge@gmail.com
* Modified: 03/20/2009	Sergio García-Nieto sergarro@isa.upv.es
* $Id: utilities.h 4 2009-07-21 17:12:11Z joroge@gmail.com $
*************************************************************************************/
#ifndef UTILITIES_H_
#define UTILITIES_H_

#include <time.h>
#include "globaldefs/globaldefs.h"

int  checksumCheck(byte* buffer, int packet_len);
void createChecksum(byte* buffer, int packet_len);
float floatFromBytesBE(const byte* buffer);
float floatFromBytesLE(const byte* buffer);
unsigned long longFromBytesBE(const byte* buffer);
signed long longFromBytesLE(const byte* buffer);
unsigned short uSintFromBytesBE(byte* buffer);
signed int sIntFromBytesBE(byte* buffer);
void dataLogging(struct imu *imuData,struct gps *gpsData);
void displayMessage(struct imu *imuData,struct gps *gpsData);
double getTime(void);
float dmsToRad(float deg, float min, float seg);
float dmsToDeg(float degree, float minute, float second);
struct dms DegToDms(double deg);
void snap_time_interval(char *threadname,int displaytime,short id);
double get_time_interval(short id);
double piBound(double angle);
double twoPiBoound(double angle);
struct timespec diff_tiempos(int tarea,struct timespec t2, struct timespec t1,int inc_perdidos);
struct timespec sum_tiempos(struct timespec t2, struct timespec t1);


#endif /*UTILITIES_H_*/
